package com.wx.spider.pc.listener;

import com.wx.spider.pc.socket.WxbizWebSocket;
import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.spring.annotation.MessageModel;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author:feng
 * @create:2021-04-23 9:52
 */
@Component
@Slf4j
@RocketMQMessageListener(topic = "ws-get-list-socket", consumeThreadMax = 8, consumerGroup = "ws-consumer-pm-to-java-socket",messageModel = MessageModel.BROADCASTING)
public class PMToJavaSocketListener implements RocketMQListener<String> {

    @Autowired
    private WxbizWebSocket wxbizWebSocket;

    @Override
    public void onMessage(String msg) {
        log.info(msg);
        wxbizWebSocket.sendMessage("run");
    }
}
